import implementaciones.SplayTree;



public class SplayTreeSet implements WordSet{

    //RedBlackSearchTree donde se guardarÃ¡n las palabras.
    
    private SplayTree<Word> theWordTree;
    
    /**
     * Constructor del SplayTreeSet
     */
    public SplayTreeSet(){
        theWordTree = new SplayTree<>();
    }
    
    @Override
  
    public void add(Word wordObject) {
        if(!theWordTree.contains(wordObject)){
            theWordTree.add(wordObject);
        }
    }

    
    public Word get(Word word) {
        //Se revisa si la palabra existe
        if(theWordTree.contains(word)){
            //De ser asÃ­, se devuelve la misma palabra.
            return theWordTree.get(word);
        }else{
            return null;
        }
    }
        
}